package com.vict;

import com.vict.config.Init;
import com.vict.dao.AutoApiSqlMapper;
import com.vict.dao.TaskExecuteInstanceDao;
import com.vict.util.SpringUtils;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import org.springframework.context.ConfigurableApplicationContext;
import org.springframework.scheduling.annotation.EnableScheduling;

import java.net.URISyntaxException;

// @MapperScan(basePackages = "com.vict.mapper")
@EnableScheduling
@SpringBootApplication(scanBasePackages = {"com.vict"}, exclude = {DataSourceAutoConfiguration.class})
// @EnableAutoConfiguration(exclude={DataSourceAutoConfiguration.class})
public class ApplicationMain {

    public static ConfigurableApplicationContext context;

    @Autowired
    private Init init;

    public static TaskExecuteInstanceDao taskExecuteInstanceDao;
    public static AutoApiSqlMapper autoApiSqlMapper;



    public static void main(String[] args) throws URISyntaxException {
        System.setProperty("java.awt.headless", "false");
        ApplicationMain.context = SpringApplication.run(ApplicationMain.class, args);

        taskExecuteInstanceDao = SpringUtils.getBean(TaskExecuteInstanceDao.class);
        autoApiSqlMapper = SpringUtils.getBean(AutoApiSqlMapper.class);

        Init init = SpringUtils.getBean(Init.class);
        // Init init = new Init();
        init.init();

        GuiApplication.guiApplication = new GuiApplication();
        GuiApplication.guiApplication.init();
    }
}

